package com.smart.five.ioc.annotation.attribute;

import com.smart.five.ioc.annotation.LoginDao;
import com.smart.five.ioc.annotation.UserMessageDao;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Service;

/**
 * user Service
 *
 * @author junrui.wang
 * @create 2018/6/14
 */
@Service("userService")
public class UserMessageService {
    @Autowired
    @Qualifier("userMessageDao") // 多个匹配的bean时，可以指定bean的名称
    private UserMessageDao userMessageDao;

    @Autowired(required = false) //可以找不到对应的bean，true时必须要有对应的bean，不然会抛错
    private LoginDao loginDao;
}
